package com.zbec.mdrs.entity.report;

import com.zbec.framework.core.entity.IdEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;


@Entity
@Table(name = "TB_REPORT_TASK")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ReportTask extends IdEntity {

	private String businessType;
	private Date businessMonth;
    private Integer reportTimes;
    private String status;

    private Set<ReportFile> files = new HashSet<ReportFile>();

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public Date getBusinessMonth() {
        return businessMonth;
    }

    public void setBusinessMonth(Date businessMonth) {
        this.businessMonth = businessMonth;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getReportTimes() {
        return reportTimes;
    }

    public void setReportTimes(Integer reportTimes) {
        this.reportTimes = reportTimes;
    }

    @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.LAZY)
    @JoinColumn(name = "TASK_ID")
    @OrderBy("id")
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public Set<ReportFile> getFiles() {
        return files;
    }

    public void setFiles(Set<ReportFile> files) {
        this.files = files;
    }
}